package com.example.javabase.multithread.base;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author He Changjie on 2021/7/10
 */
public class MyThreadMain {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyThread1 myThread1 = new MyThread1();
        myThread1.join();
        myThread1.start();

        new Thread(new MyThread2()).start();

        MyThread3 myThread3 = new MyThread3();
        FutureTask<String> futureTask = new FutureTask<>(myThread3);
        new Thread(futureTask).start();
        // futureTask.get()具有阻塞效果
        System.out.println(futureTask.get());
        System.out.println("end");
    }
}
